package com.seepln.util;
/**
 * Created by
 *
 * @auth: liqy
 * on 2021/4/20 15:22.
 * desc:
 */

/**
 * @ClassName: PathUtil
 * @Description: TODO
 * @Author: liqy
 * @CreateDate: 2021/4/20 15:22
 * @UpdateUser: liqy
 * @UpdateDate: 2021/4/20  15:22
 * @UpdateRemark: update TODO
 * @Version: 1.0
 */
public class PathUtil {

    public static String getPathBySourcePath(String path) {
        if (System.getProperty("os.name").contains("dows")) {
            return path.substring(1, path.length());
        }
        return path;
    }

    public String getPath() {
        String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
        if (System.getProperty("os.name").contains("dows")) {
            path = path.substring(1, path.length());
        }
        if (path.contains("jar")) {
            path = path.substring(0, path.lastIndexOf("."));
            return path.substring(0, path.lastIndexOf("/"));
        }
        return path.replace("target/classes/", "");
    }
}
